home *** CD-ROM | disk | FTP | other *** search
/ Enciclopedia Del Perro / Enciclopedia Del Perro.iso / info31 / simple4.sc_ / simple4.sc
Text File  |  1994-06-20  |  4KB  |  102 lines

  1. <******************************************************* language=slang
  2.  
  3. Sample SLANG Modem Dialup Script
  4.  
  5. Description:
  6.  
  7.     Simple Example #4 -- Written in the SLANG scripting language
  8.  
  9.     This script dials the modem.  It then checks "polls" the
  10.     serial line to see if the modem has connected with the remote
  11.     modem.  If the connection has been made the script enters a
  12.     user-id after a short delay, then a password after another
  13.     short delay and, finally, packet mode is enabled so enable
  14.     TCP/IP data transfers.  If no connetion is made the script
  15.     informs the user and ends.
  16.  
  17.     This script does not store a user id or password directly,
  18.     but uses the ones that were entered in WDial's Configuration
  19.     Window.
  20.  
  21. To Use This Script:
  22.  
  23.     Change "0000" to the phone number of the remote machine you
  24.     would like to connect to.
  25.  
  26.     Be sure the enter your password and user id in WDial's
  27.     Configuration Window.
  28.  
  29.     Adjust the intervals in the (pause,...) functions to suit
  30.     your needs.  These are in milliseconds (5000 milliseconds ==
  31.     5 seconds).
  32.  
  33.     This script assumes that your modem, and the remote host,
  34.     terminate commands with an ASCII Carrage-Return character.
  35.     If, instead, a Carrage-Return/Line-Feed (CRLF) is required,
  36.     change "(cr)" to "(cr)(lf)" everywhere in the script it is
  37.     necessary.
  38.  
  39. Notes:
  40.  
  41.     This is a very simple dial script.  It assumes that, once the
  42.     modem connection has been made the following will be true:
  43.  
  44.     o    the remote machine will always be ready for your
  45.         user-id after a set interval
  46.  
  47.     o    like-wise for your password
  48.  
  49.     It is more robust than simpler examples in that it checks to
  50.     see if the modem connected or not, and acts accordingly.
  51.     There is no provision for retries, or verification of the
  52.     remote host, all of which are possible in SLANG.  The script
  53.     also assumes that there will be a user id and password prompt
  54.     after set intervals.
  55.  
  56. Built-In SLANG Functions Used:
  57.  
  58.     send        Send a character string to the modem.
  59.     cr        Return a Carriage-Return character.
  60.     poll        Wait for the serial line to change state.
  61.     pause        Wait a specified number of milliseconds.
  62.     username    Return username from WDial's Configuration Window.
  63.     password    Return password from WDial's Configuration Window.
  64.     conecho        Turn on or off local echo from script or keyboard.
  65.     changemode    Changes mode of connection from "raw" to "packet".
  66.  
  67. ************************************************************************>
  68.  
  69. (send,                <* Dial the remote modem/host        *>
  70.     {ATDT0000}        <*    Modem command and phone number    *>
  71.     (cr)            <*    Carrage-Return after modem cmd    *>
  72. )                <*    End of "send" function        *>
  73.  
  74. (poll, physical, open, 30000,    <* Wait for the modem to connect    *>
  75.   {                <* IF THE MODEM CONNECTED SUCESSFULLY   *>
  76.     (pause, 5000)        <*  Wait for remote machine's prompt    *>
  77.                 <*  Log-in to the remote modem/host    *>
  78.     (send, (username) )        <*    Send your user id        *>
  79.     (send, (cr) )        <*    Carrage-Return after user id    *>
  80.     (pause, 5000)        <*  Wait for a password prompt        *>
  81.     (conecho,off)        <*  Don't display password locally    *>
  82.                 <*  Send the password            *>
  83.     (send, (password) )        <*    Send password            *>
  84.     (send, (cr) )        <*    Carrage-Return after password    *>
  85.     (conecho)            <*  Continue display locally        *>
  86.     (pause, 5000)        <*  Pause for a moment            *>
  87.     (changemode, packet)    <*  Change to "packet" mode        *>
  88.   }                <* END IF THE MODEM CONNECTED        *>
  89.  
  90.   ,                <* Comma delimits "Else" part of "poll" *>
  91.  
  92.   {                <* ELSE IF THE MODEM DOSN'T CONNECT    *>
  93.     (output,
  94.              {
  95.  
  96.         The Modem didn't connect.  End of Script.
  97.  
  98. }                <*  Everything between { } is displayed    *>
  99.     )                <* End of the "output" function        *>
  100.   }                <* END IF THE MODEM DOESN'T CONNECT    *>
  101. )                <* End of the "poll" function        *>
  102.